/*
 *  This file is part of libgolf.
 * 
 *  libgolf is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  libgolf is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with libgolf.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * CxxTest reference: http://cxxtest.sourceforge.net/guide.html
 */

#ifndef _TESTTEEBOX_H
#define _TESTTEEBOX_H

#include <vector>
#include <cxxtest/TestSuite.h>
#include "../gensrc/Rating.h"
#include "../gensrc/Golfhole.h"
#include "../gensrc/Uuid.h"
#include "../gensrc/Teebox.h"

class testTeebox : public CxxTest::TestSuite
{
    public:
        void test_teebox_factory(void)
        {
            Teebox                  *tb;
            Rating                  rtn(69.3, 121u);
            Golfhole                gh(1u, 4u, 1u, 388u);
            std::vector<Golfhole>   ghv;
            Uuid                    uuid;
            
            for (unsigned int idx = 0; idx < 18; ++idx)
            {
                gh.set_number(idx + 1);
                gh.set_SI(idx + 1);
                ghv.push_back(gh);
            }

            tb = Teebox::from_data(L"Biale", rtn, ghv, uuid);

            TS_ASSERT_EQUALS(tb->get_name(), L"Biale");
            TS_ASSERT_EQUALS(tb->get_par(), 18 * 4u);
            TS_ASSERT_EQUALS(tb->get_length(), 18 * 388u);
            TS_ASSERT_EQUALS(tb->get_rating(), rtn);
            // get_golfholes
            TS_ASSERT_EQUALS(tb->get_uuid(), uuid);
            TS_ASSERT_EQUALS(tb->get_teebox_type(), Teebox::TEEBOX_18);
            
            delete tb;
        }
};

#endif /* _TESTTEEBOX_H */
